import { GlobalApi } from '@/common'

// 获取 cos 临时密钥
export const credentialService = async () => {
  try {
    const data = await GlobalApi.credential()
    const { credentials, startTime, expiredTime } = data
    const { tmpSecretId, tmpSecretKey, sessionToken } = credentials
    return {
      TmpSecretId: tmpSecretId,
      TmpSecretKey: tmpSecretKey,
      ExpiredTime: expiredTime,
      SecurityToken: sessionToken,
      StartTime: startTime // 时间戳，单位秒
    }
  } catch (error) {
    console.log('%c 🥝 error 🥝-32', 'font-size:13px; background:#1fc7ae; color:#63fff2;', error)
  }
}
